home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / tcl / dist6.3 / tests / llength.test < prev    next >
Encoding:
Text File  |  1991-09-06  |  1.4 KB  |  39 lines

  1. # Commands covered:  llength
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright 1991 Regents of the University of California
  8. # Permission to use, copy, modify, and distribute this
  9. # software and its documentation for any purpose and without
  10. # fee is hereby granted, provided that this copyright notice
  11. # appears in all copies.  The University of California makes no
  12. # representations about the suitability of this software for any
  13. # purpose.  It is provided "as is" without express or implied
  14. # warranty.
  15. #
  16. # $Header: /sprite/src/lib/tcl/tests/RCS/llength.test,v 1.1 91/09/06 14:48:03 ouster Exp $ (Berkeley)
  17.  
  18. if {[string compare test [info procs test]] == 1} then {source defs}
  19.  
  20. test llength-1.1 {length of list} {
  21.     llength {a b c d}
  22. } 4
  23. test llength-1.2 {length of list} {
  24.     llength {a b c {a b {c d}} d}
  25. } 5
  26. test llength-1.3 {length of list} {
  27.     llength {}
  28. } 0
  29.  
  30. test llength-2.1 {error conditions} {
  31.     list [catch {llength} msg] $msg
  32. } {1 {wrong # args: should be "llength list"}}
  33. test llength-2.2 {error conditions} {
  34.     list [catch {llength 123 2} msg] $msg
  35. } {1 {wrong # args: should be "llength list"}}
  36. test llength-2.3 {error conditions} {
  37.     list [catch {llength "a b c \{"} msg] $msg
  38. } {1 {unmatched open brace in list}}
  39.